import request from '@/utils/request'

export const getDictionariesList = (dictionaryId, type = 1) => { //获取数据字典
  return request.request({
    url: '/sys-center/api/system/dictionary/' + dictionaryId + '/' + type,
    method: 'get',
  })
}

export const getDictionariesListMultiple = (data) => { //获取数据字典多个
  return request.request({
    url: '/sys-center/api/system/dictionary/fatherIds',
    method: 'post',
    data
  })
}

export const getDictionariesTree = (id) => { //获取分类字典
  return request.request({
    url: '/sys-center/api/system/classification/class/tree/' + id,
    method: 'get',
  })
}


export const projectFileList = (data) => { //项目文件-列表
  return request.request({
    url: '/project-quality/api/project/doc/page',
    method: 'post',
    data
  })
}

export const projectFileAdd = (data) => { //项目文件-添加
  return request.request({
    url: '/project-quality/api/project/doc',
    method: 'post',
    data
  })
}
//原 put
export const projectFileEdit = (data) => { //项目文件-编辑
  return request.request({
    url: '/project-quality/api/project/put/doc',
    method: 'post',
    data
  })
}
//原 del
export const projectFileDelete = (id) => { //项目文件-删除
  return request.request({
    url: '/project-quality/api/project/doc/del/' + id,
    method: 'get',
  })
}

export const projectFileDetails = (id) => { //项目文件-详情
  return request.request({
    url: '/project-quality/api/project/doc/' + id,
    method: 'get',
  })
}

export function teamPeople(id) { //人员信息
  return request({
    url: '/hose-management/api/supplier/people/allByHoseSupplierId/' + id,
    method: 'get',
  })
}

export function projectApplicationAll(data) { //立项申请列表
  return request({
    url: '/maintenance-management/api/maintenance/project/approval/all',
    method: 'post',
    data
  })
}
export function unitToDepartment(id) { //根据单位查询部门
  return request({
    url: '/sys-center/api/system/dept/tree-not/'+id,
    method: 'get',
  })
}


export function downloadCommon(id) { //通过数据Id下载公共附件
  return request({
    url: '/sys-center/api/common/download/common/'+id,
    responseType: 'arraybuffer',
    method: 'GET',
  })
}

export function downloadCommonOne(data) { //通过地址下载公共附件
  return request({
    url: '/sys-center/api/common/download/url',
    responseType: 'arraybuffer',
    method: 'post',
    data
  })
}


export function getBranchOffice() { //获取所有二级分公司
  return request({
    url: '/sys-center/api/system/dept/second/level/all',
    method: 'get',
  })
}


export function getfacilityTreeA(data) { //根据设施查询下面的系统跟设备
  return request({
    url: '/project-quality/api/equipmentInfo/facilityTreeA',
    method: 'post',
    data
  })
}


export function onlineDuration(data) { //登录-在线时长
  return request({
    url: '/sys-center/api/hours',
    method: 'post',
    data
  })
}

